﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace PersonalWebSite.Common.Google.DTO
{
    /// <summary>
    /// Defines an albums photo feed from Picasa
    /// </summary>
    public class PicasaPhotosFeed
    {
        /// <summary>
        /// Gets or Sets the Id
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// Gets or Sets the Updated Date
        /// </summary>
        public DateTime DateUpdated { get; set; }

        /// <summary>
        /// Gets or Sets the Title
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// Gets or Sets the Subtitle
        /// </summary>
        public string Subtitle { get; set; }

        /// <summary>
        /// Gets or Sets the IconUrl
        /// </summary>
        public string IconUrl { get; set; }

        /// <summary>
        /// Gets or Sets the AlbumId
        /// </summary>
        public string AlbumId { get; set; }

        /// <summary>
        /// Gets or Sets the Location
        /// </summary>
        public string Location { get; set; }

        /// <summary>
        /// Gets or Sets the ImageCount
        /// </summary>
        public int ImageCount { get; set; }

        /// <summary>
        /// Gets or Sets the GeoLocation
        /// </summary>
        public Geocode GeoLocation { get; set; }

        /// <summary>
        /// Gets or Sets the Items
        /// </summary>
        public PhotoItem[] Items { get; set; }

        #region Computed Properties
        /// <summary>
        /// Gets the computed google small map image CSS url for this activity
        /// </summary>
        public string GoogleMiniMapImageCssUrl
        {
            get
            {
                return GeoLocation == null ? null : string.Format("url('http://maps.googleapis.com/maps/api/staticmap?center={0},{1}&zoom=1&size=100x50&markers=size:tiny%7Ccolor:0x125C8A%7C{0},{1}&sensor=false')", GeoLocation.Latitude, GeoLocation.Longitude);
            }
        }
        #endregion

        #region Helper Classes
        /// <summary>
        /// Defines a Picasa Photo Item
        /// </summary>
        public class PhotoItem
        {
            /// <summary>
            /// Gets or Sets the Id
            /// </summary>
            public string Id { get; set; }

            /// <summary>
            /// Gets or Sets the Published Date
            /// </summary>
            public DateTime DatePublished { get; set; }

            /// <summary>
            /// Gets or Sets the Updated Date
            /// </summary>
            public DateTime DateUpdated { get; set; }

            /// <summary>
            /// Gets or Sets the Title
            /// </summary>
            public string Title { get; set; }

            /// <summary>
            /// Gets or Sets the Summary
            /// </summary>
            public string Summary { get; set; }

            /// <summary>
            /// Gets or Sets the Description
            /// </summary>
            public string Description { get; set; }

            /// <summary>
            /// Gets or Sets the ImageUrl
            /// </summary>
            public string ImageUrl { get; set; }

            /// <summary>
            /// Gets or Sets the Picasa Image URL
            /// </summary>
            public string PicasaUrl { get; set; }

            /// <summary>
            /// Gets or Sets the ThumbnailSmallUrl
            /// </summary>
            public string ThumbnailSmallUrl { get; set; }

            /// <summary>
            /// Gets or Sets the ThumbnailMediumUrl
            /// </summary>
            public string ThumbnailMediumUrl { get; set; }

            /// <summary>
            /// Gets or Sets the ThumbnailLargeUrl
            /// </summary>
            public string ThumbnailLargeUrl { get; set; }

            /// <summary>
            /// Gets or Sets the PhotoId
            /// </summary>
            public string PhotoId { get; set; }

            /// <summary>
            /// Gets or Sets the AlbumId
            /// </summary>
            public string AlbumId { get; set; }

            /// <summary>
            /// Gets or Sets the Width
            /// </summary>
            public int Width { get; set; }

            /// <summary>
            /// Gets or Sets the Height
            /// </summary>
            public int Height { get; set; }

            /// <summary>
            /// Gets or Sets the Size
            /// </summary>
            public int Size { get; set; }

            /// <summary>
            /// Gets or Sets the GeoLocation
            /// </summary>
            public Geocode GeoLocation { get; set; }

            #region Computed Properties
            /// <summary>
            /// Gets the computed google small map image CSS url for this activity
            /// </summary>
            public string GoogleMiniMapImageCssUrl
            {
                get
                {
                    return GeoLocation == null ? null : string.Format("url('http://maps.googleapis.com/maps/api/staticmap?center={0},{1}&zoom=1&size=100x50&markers=size:tiny%7Ccolor:0x125C8A%7C{0},{1}&sensor=false')", GeoLocation.Latitude, GeoLocation.Longitude);
                }
            }
            #endregion
        }
        #endregion
    }
}